
#ifndef RAY_CASTER_H
#define RAY_CASTER_H

#include<math.h>
#include<stdio.h>
#include<stdlib.h>
#include"algfloat.h"
#include"ray.h"

#ifndef M_PI
#define M_PI 3.1415926535898
#endif

class RayCaster{
  int nx,ny;
  int pdiv;
  float s, ratio;
  public:
  RayCaster (float fovy, float aspect, int n_x, int n_y, int p_div):
    nx(n_x),ny(n_y),pdiv(p_div),ratio(aspect) 
  {
    s = 1/tan(fovy / 360 * M_PI);
    printf("RayCaster s=%f\n",s);
  };
  void ChangeNs(int n_x, int n_y)
  {
    nx=n_x; ny=n_y;
  };
  int GetRayForLimit ()
  {
    return pdiv*pdiv;
  };
  //a principio manda o raio no meio do pixel
  void Cast (Ray * ray, int x, int y, bool aa) const;
};

#endif
